package com.shangma.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * @className: AsyncManager
 * @description:
 * @date:2021/12/22 15:42
 */
// 通过线程池执行异步任务
@Component
public class AsyncManager {
    @Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
    // 通过线程池执行
    public void execute(Runnable r){
        threadPoolTaskExecutor.execute(r);
    }

}
